<%@page import="cn.it.ygh.service.impl.HouseServiceImpl"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta charset="UTF-8">
	<title>房源基本信息</title>
    <link rel="stylesheet" rev="stylesheet" href="${pageContext.request.contextPath}/house/css/Common_Publish.css" type="text/css">
    <link href="${pageContext.request.contextPath}/house/css/dropzone.min.css" rel="stylesheet" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/house/js/dropzone.min.js"> </script>
</head>
<body>
<div id="header">
	<div class="header">
		<h1 class="logo">
			<a href="${pageContext.request.contextPath}/users/jsp/index.jsp" class="ygf-logo" target="_blank">优购房</a>
        </h1>
	</div>
</div>
<div id="container" class="container">
    <div class="subheader">
		<div class="sh-title">
			<div class="sh-line"></div>
			<h3>免费发布房源</h3>
		</div>
		<p>每天数百万真实用户，优购房帮你快速找到精准客户。</p>
    </div><!-- Toolbar End  -->

	<div class="publish-basic">
		<form action="${pageContext.request.contextPath}/house/add.do" id="basic_publish" class="publish-box" method="post">
			<input id="hidden_cityid" name="cityid" value="" type="hidden">
			<div id="page1" style="display:block">
				<div id="page_ctrl" style="overflow: hidden; height: 490px; width: 1000px;">
					<div id="page_ctrlbar" style="height: 490px; width: 2000px;">
						<div class="basic-info" style="float: left;">
								<script type="text/javascript" src="${pageContext.request.contextPath}/house/js/Publish_Type.js"></script>
								<div id="publish_style" class="fi fi-style">
									<strong class="tit">选择发布类型</strong>
									<a tabindex="-1" href="javascript:void(0)" class="style selected" onclick="f()" id="f">出售<i class="icon ico-selected"></i></a>
									<a tabindex="-1" href="javascript:void(0)" class="style" onclick="s()" id="s">整租<i class="icon ico-selected"></i></a>
									<a tabindex="-1" href="javascript:void(0)" class="style" onclick="t()" id="t">合租<i class="icon ico-selected"></i></a>
									<input type="hidden" id="houseSellType" name="houseSellType" >
								</div>
								<!-- 选择发布类型 End -->
								<div class="fi fi-city">
									<label class="tit" for="">地址</label><input type="hidden" id="community_id" name="commid" value="" data-commname="">
									省份：<select id="province" runat="server" onchange="selectprovince(this);" style=" width:95px;height:37.5px;" name="houseProvince"></select>
									城市：<select id="city" runat="server" style=" width:95px;height:37.5px;" name="houseCity"></select>
								</div>
								<div class="fi fi-comm">
								<input tabindex="-1" type="text" class="txt" autocomplete="off" id="community" name="houseAddress" placeholder="请输入小区名称" value="">
									<span class="tips" id="community_msg" style="display: inline-block;">如：万科世纪花城 或 wksjhc</span><span class="tipsbox"></span>
									<p id="community_info" class="show-comm" style="display: none;"></p>
									<div class="comm-list" id="community_list" style="display: none;"></div>
								</div>
								<!-- 小区名称 End -->
									
								
								
								<div class="fi fi-type" id="apartment">
									<strong class="tit">户型</strong>
									<input tabindex="-1" type="text" autocomplete="off" class="txt" id="roomnum" name="roomnum" value=""><label for="roomnum">室</label>
									<input tabindex="-1" type="text" autocomplete="off" class="txt" id="hallnum" name="hallnum" value=""><label for="hallnum">厅</label>
									<input tabindex="-1" type="text" autocomplete="off" class="txt" id="toilnetnum" name="toilnetnum" value=""><label for="toilnetnum">卫</label>
									<input type="hidden" id = "houseLayout" name="houseLayout">
									<span class="tips" id="apartment_msg" style="display: inline-block;">请填写数字，不能是0</span><span class="tipsbox"></span>
								</div>
								<!-- 户型 End -->
								
								<div class="fi fi-area">
									<label class="tit" for="area">面积</label>
									<input tabindex="-1" type="text" autocomplete="off" class="txt" id="area" name="houseArea" placeholder="" value="">平米
									<span class="tips" id="area_msg" style="display:inline-block;">请填写整数</span><span class="tipsbox"></span>
								</div>
								<!-- 面积 End -->
								
								<div class="fi fi-price">
									<label class="tit" for="price">期望售价</label>
									<input tabindex="-1" type="text" autocomplete="off" class="txt" id="price" placeholder="" name="housePrice" value=""><span id="price_unit">元</span>
									<span class="tips" id="price_msg" style="display:inline-block;">请填写整数</span><span class="tipsbox"></span>
								</div><!-- 租金 End -->
								<div class="fi fi-btn">
									<a tabindex="-1" href="javascript:;" id="basic_nextstep" class="btn" onclick="if(checkInsert())next(page2,page1,page3);">下一步</a>
								</div> 
						</div>
					
					<!-- 房源发布基本信息 End -->
				
					</div>
				</div>
			</div>
			<div id="page2" style="display:none">
				<div id="page_ctrl" style="overflow: hidden; height: 490px; width: 1000px;">
					<div id="page_ctrlbar" style="height: 490px; width: 2000px;">
						<div class="authentication" style="float: left;">
							<div class="fi fi-style" id="publish_type" style="display: none;">
								<input type="hidden" value="0" id="commission" name="commission">
							</div><!-- 选择发布类型 End -->
							<div class="fi" id="brief-introduction">
								<label class="tit">简介</label>
								<textarea name="houseDesc" id="houseinfo"></textarea>
								<span class="tips" id="houseinfo_msg" style="display: inline-block;">请填写适当文字描述</span><span class="tipsbox"></span>
							</div>
								<!--  房屋简介 -->
			
							<div class="fi" id="upload-images">
								<label class="tit">上传图片</label>
								<div id = "houseImg" class = "dropzone"></div>
						    	<input type = "button" value = "上传" onclick="dropz.processQueue()" />
								<!-- 初始化时传入img信息 -->
								<div class="upload-wrap">

								</div>
								<input type="hidden" value="" id="images" name="houseImg" /> 
							</div>
							
							<div class="fi fi-btn">
								<a tabindex="-1" href="javascript:;" id="sub_self" class="btn" onclick="next(page1,page2,page3)">上一步</a>
								<a tabindex="-1" href="javascript:;" id="sub_self" class="btn" onclick="if(checkText())next(page3,page1,page2);">下一步</a>
							</div>
							<div class="lightspot" style="display:block;">
							</div><!-- 亮点 End -->
						</div>
					</div>
				</div>
			</div>
			<div id="page3" style="display:none">
				<div id="page_ctrl" style="overflow: hidden; height: 490px; width: 1000px;">
					<div id="page_ctrlbar" style="height: 490px; width: 2000px;">
						<div class="authentication" style="float: left;">
							 <div class="fi" id="agent_a">
								 <label class="tit" for="">中介名</label>
								 <select id="agentaccount" name="houseAgentAccount" style=" width:300px;height:37.5px;">
								 <c:forEach items="${agentList}" var = "t"> 
								 	<option value="${t.agentAccount}">${t.agentAccount}</option>
								 </c:forEach>
								 </select><br>
								 <span class="tips" id="agentaccount_msg" style="display: inline-block;">必须选择</span><span class="tipsbox"></span>
							 </div>

							 <div class="fi" id="agent_t">
								 <label class="tit" for="">中介联系方式</label>
								 <select id="agentele" name="houseAgentTele" style=" width:100px;height:37.5px;">
								 <c:forEach items="${agentList}" var = "t">
								 	<option value="${t.agentTele}">${t.agentTele}</option>
								 </c:forEach>
								 </select><br>
								 <span class="tips" id="agentele_msg" style="display:inline-block;">必须选择</span><span class="tipsbox"></span>
							 </div>
								
							<div class="fi fi-btn">
								<a tabindex="-1" href="javascript:;" id="" class="btn" onclick="next(page2,page1,page3)">上一步</a>
								<a tabindex="-1" href="javascript:checkNull()" id="sub_self" class="btn">发布房源</a>
							</div>
							<div class="lightspot" style="display:block;">
							</div><!-- 亮点 End -->
						</div>
					</div>
				</div>
			</div>
	</div>
	<ul class="hot-tips">
		<li class="cheapest">
			<i></i>
			<dl>
				<dt>最优价格</dt>
				<dd>
					<p>优购房联合专业经纪人为您</p>
					<p>估价，帮您达成最优交易</p>
				</dd>
			</dl>
		</li>
		<li class="fastSale">
			<i></i>
			<dl>
				<dt>快速出手</dt>
				<dd>
					<p>委托给专业可靠的经纪人，</p>
					<p>快速成交，省时省心</p>
				</dd>
			</dl>
		</li>
		<li class="save">
			<i></i>
			<dl>
				<dt>拒绝骚扰</dt>
				<dd>
					<p>最多推荐5位经纪人帮您卖房，您还</p>
					<p>可以选择隐藏手机号</p>
				</dd>
			</dl>
		</li>
	</ul>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/house/js/next.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/house/js/chooseAddress.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/house/js/checkInsert.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/house/js/checkText.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/house/js/checkNull.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">
  Dropzone.autoDiscover=false;
  var dropz=new Dropzone("#houseImg",{
  			url: "${pageContext.request.contextPath}/house/upload.do",
    		addRemoveLinks:true,
    		autoProcessQueue:false,
    		parallelUploads:4,
    		maxFiles:4,
    		init: function(){
    			this.on("removedfile",function(file){
    				console.log();
    				console.log("File " + file.name + "removed");
    			});
    			this.on("success",function(file,data){
    				console.log(data.path.toString());
    				document.getElementById("images").value +=data.path.toString()+'#';
    			});
    		},
    	
    	});
</script>
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/lib/layer/2.4/layer.js"></script>
<script type="text/javascript">
	function checkNull(){
	      var houseLayout= document.getElementById("roomnum").value+'#'+ document.getElementById("hallnum").value+'#'+document.getElementById("toilnetnum").value;
		  document.getElementById("houseLayout").value=houseLayout; 
		  var houseSellType=document.getElementsByClassName("selected")[0].innerText;
	      document.getElementById("houseSellType").value=houseSellType;
	      document.getElementById("basic_publish").submit();
	      layer.msg('发布成功!',{icon:1,time:2000});
  }
</script>
</body></html>
